package main

import (
	"fmt"
	"math/rand"
)

func main() {
	var nums []int
	sum, product := 0, 1

	for len(nums) < 20 {
		num := rand.Intn(19) + 1
		nums = append(nums, num)
	}

	fmt.Println("生成的20个非0正整数:")
	for i, num := range nums {
		fmt.Printf("%d ", num)

		if i%2 == 0 {
			sum += num
		} else {
			product *= num
		}
	}

	fmt.Println("\n第奇数个数的和:", sum)
	fmt.Println("第偶数个数的积:", product)
}
